package com.micro.modual.controller;

import com.micro.core.resp.RespJson;
import com.micro.core.resp.RespJsonData;
import com.micro.core.resp.RespJsonPageData;
import com.micro.modual.model.bo.systempost.PostStatusBO;
import com.micro.modual.model.bo.systempost.SystemPostBO;
import com.micro.modual.model.dto.systempost.SystemPostDetailDTO;
import com.micro.modual.model.dto.systempost.SystemPostListDTO;
import com.micro.modual.service.SystemPostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;

import java.util.Map;

/**
 * <h1>系统岗位表 控制器</h1>
 * @author levelcoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020-08-04 00:27:46
 */
@Api(value = "岗位管理",tags = "岗位管理")
@RestController
@RequestMapping(value = "systemPost")
public class SystemPostController {

    @Autowired
    private SystemPostService systemPostService;

    /**
     * <h2>查找系统岗位表 列表</h2>
     * @param params 列表查询请求对象
     * @return List<SystemPostListDTO> {@link SystemPostListDTO}s  系统岗位表 列表返回对象
     */
    @ApiOperation(value = "查询系统岗位表列表" ,notes = "查询系统岗位表列表")
    @GetMapping(value = "/findSystemPostList")
    public RespJsonPageData<SystemPostListDTO> findSystemPostList(@RequestParam  Map<String,Object> params){
        return systemPostService.findList(params,SystemPostListDTO.class);
    }

    /**
     * <h2>根据主键编号查看系统岗位表详情</h2>
     * @param id  系统岗位表 主键编号
     * @return {@link SystemPostDetailDTO}  系统岗位表 详情
     */
    @ApiOperation(value = "查询系统岗位表详情",notes = "根据主键编号，查询系统岗位表详情")
    @GetMapping(value = "/findSystemPostDetail/{id}")
    public RespJsonData<SystemPostDetailDTO> findSystemPostDetail(@PathVariable("id") Long id){
        return systemPostService.findDetail(id,SystemPostDetailDTO.class);
    }

    /**
     * <h2>新增系统岗位表详情</h2>
     * @param systemPostBO {@link SystemPostBO} 系统岗位表 新增/修改 请求对象
     * @return {@link RespJson} 返回结果基础类
     */
    @ApiOperation(value = "新增系统岗位表",notes = "新增系统岗位表")
    @PostMapping(value = "/addSystemPost")
    public RespJson addSystemPost(@RequestBody SystemPostBO systemPostBO){
        return systemPostService.addSystemPost(systemPostBO);
    }

    /**
     * <h2>修改系统岗位表详情</h2>
     * @param systemPostBO  {@link SystemPostBO} 系统岗位表 新增/修改 请求对象
     * @return {@link RespJson} 返回结果基础类
     */
    @ApiOperation(value = "修改系统岗位表",notes = "修改系统岗位表")
    @PostMapping(value = "/editSystemPost")
    public RespJson editSystemPost(@RequestBody SystemPostBO systemPostBO){
        return systemPostService.editSystemPost(systemPostBO);
    }

    /**
     * <h2>根据主键编号删除系统岗位表信息</h2>
     * @param id  系统岗位表 主键编号
     * @return  {@link RespJson} 返回结果基础类
     */
    @ApiOperation(value = "删除系统岗位表",notes = "根据地址ID，删除系统岗位表")
    @PostMapping(value = "/deleteSystemPost/{id}")
    public RespJson deleteSystemPost(@PathVariable("id") Long id){
        return systemPostService.deleteSystemPost(id);
    }

    /**
     * <h2>修改岗位状态</h2>
     * @param postStatusBO
     * @return
     */
    @PostMapping(value = "/modifyPostStatus")
    public RespJson modifyPostStatus(@RequestBody PostStatusBO postStatusBO){
        return systemPostService.modifyPostStatus(postStatusBO);
    }
}

